package com.liyawen.web;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ToJspServlet extends HttpServlet
{
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		String method = request.getParameter("_m");
		if("main".equals(method))
		{
			request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request, response);
		}
		else if("list".equals(method))
		{
			request.getRequestDispatcher("/WEB-INF/views/list.jsp").forward(request, response);
		}
		else if("msg".equals(method))
		{
			request.getRequestDispatcher("/WEB-INF/views/msg.jsp").forward(request, response);
		}
		else if("send".equals(method))
		{
			request.getRequestDispatcher("/WEB-INF/views/send.jsp").forward(request, response);
		}
		else
		{
			response.sendError(404);
		}
	}
}
